package com.pine.dcts.handler;

import com.pine.dcts.common.CURDHandler;
import com.pine.dcts.common.Result;
import com.pine.dcts.entity.Org;
import com.pine.dcts.service.OrgService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author xiaoyuan
 * @create 2020/11/23 14:12
 **/
@RequestMapping("/org")
@RestController
@Slf4j
public class OrgHandler extends CURDHandler<OrgService, Org> {

    @GetMapping("/tree")
    public Result<List<Org>> tree(String name) {
        return success(this.service.tree(name));
    }

    @GetMapping("/enabledTree")
    public Result<List<Org>> enabledTree(String name) {
        return success(this.service.enabledTree());
    }
}
